Male and female contributions to diversity among birdwing butterfly images

Machine learning (ML) newly enables tests for higher inter-species diversity in visible phenotype (disparity) among males versus females, predictions made from Darwinian sexual selection versus Wallacean natural selection, respectively. Here, we use ML to quantify variation across a sample of > 16,000 dorsal and ventral photographs of the sexually dimorphic birdwing butterflies (Lepidoptera: Papilionidae). Validation of image embedding distances, learnt by a triplet-trained, deep convolutional neural network, shows ML can be used for automated reconstruction of phenotypic evolution achieving measures of phylogenetic congruence to genetic species trees within a range sampled among genetic trees themselves. Quantification of sexual disparity difference (male versus female embedding distance), shows sexually and phylogenetically variable inter-species disparity. Ornithoptera exemplify high embedded male image disparity, diversification of selective optima in fitted multi-peak OU models and accelerated divergence, with cases of extreme divergence in allopatry and sympatry. However, genus Troides shows inverted patterns, including comparatively static male embedded phenotype, and higher female than male disparity – though within an inferred selective regime common to these females. Birdwing shapes and colour patterns that are most phenotypically distinctive in ML similarity are generally those of males. However, either sex can contribute majoritively to observed phenotypic diversity among species.


Biology, natural history and behaviour of birdwing butterflies -Supplementary Note 1
While the protected status of birdwing butterflies restrict the range of experiments which may be performed on the group 1 , a number of detailed studies of morphology have been performed on small samples of birdwing species and specimens, many of these focusing primarily on the morphology only of males 1,2 .These studies have revealed a range of mechanisms producing the spectacular colouration among these butterflies, including pigments unique to papilionid butterflies, some of which have been shown to be fluorescent 3 , as well as species or sub-specific structural scale morphologies that generate iridescence and combined effects from pigmentary and structural colouration 1 .
Birdwings are primarily species of primary tropical forest where their foodplant vines grow, though some species extend to disturbed forest or parks if their larval foodplant is present 4,5 .Given their dependence on tropical forest, birdwings are at conservation risk from a range of environmental pressures including logging and framing as well as illegal trade prompted by their visual attractiveness.
Several authors have suggested the opinion that female birdwing butterflies are, in general, less brightly coloured than males 3 .However, it has also been noted that birdwing butterfly larvae feed on toxic foodplants and both male and female adults can have some wing areas with brightly reflective colouration, indicating the potential for aposematic signalling to potential predators 1 .Birdwing butterfly larvae, feed on hostplants of the family Aristolochiaceae (birthworts) which produce highly toxic aristolochic acids (e.g.O. primus, Aristolchia) [4][5][6] .However, larvae 6 and adults 7 have been observed to be attacked, and sometimes eaten, by predators including birds as well as ants and wasps, while other local potential predators include spiders, frogs 8 and lizards 6 .Furthermore, aspects of both male and female dimorphic colouration, visible on the wing, have been noted to be recognisable to a human observer (e.g. in Trogonoptera brookiana 8,9 ).In general, it is also hypothesised that aposematic colour patterns may have additional cryptic or camouflage functions, for example when viewed from a greater distance.Male birdwings have also been observed in territorial flights (e.g.Trogonoptera brookiana 9 , Troides dohertyi 5 ) sometimes involving direct physical contact, indicating the potential importance of visual recognition of male conspecifics.Differences in behaviour between male and female birdwing butterflies have been observed, with relevance for the evolutionary selection pressures on sexual dimorphism.
Birdwing butterflies exhibit elaborate courtship displays, although mating with newly emerged females with more limited male courtship has also been observed (e.g.Ornithoptera priamus 5 and Troides oblongomaculatus 10 ).Both males and females can participate in courtship flights 8,9 .While comprehensive biological records for birdwing butterfly species are lacking 8 , there are isolated natural history records for both genera Trogonoptera and Troides of courtship displays in which the male maintains a flight position above a flying female, the female therefore viewing the male dorsal surface, and vice versa, e.g. in Trogonoptera brookiana 8,9 and Troides darsius 8 .Footage of male courtship display in Ornithoptera priamus, for example, shows that the males move into and out of a position and wing inclination in which the dorsal surface of the hindwings is in front of the head of the female.Male Troides (e.g.T. oblongomaculatus) possess scent (androconial) pouches which are engaged with female antennae via a flight manoeuvre in which the male flies against the female from below and behind 10 .Male Ornithoptera also possess similar hairs on the inner margin of the hindwing 10 .Structural analysis of the dorsal hindwing of the birdwing butterfly Troides magellanus, shows that the dorsal hindwing (which is pigmented in bright yellow, while the dorsal forewing is predominantly black) shows a flash of iridescence when viewed from at an angle close to the wing plane 3 , producing structural colour variation which is visible in flight 8 .The authors of that study state that the female of this species, while possessing areas of bright yellow pigmentary wing colouration, does not exhibit iridescence 3 .
A similar iridescence phenomenon is also visible in photographs of male Troides prattorum, and also noted to occur, to a reduced degree, in the female 8 .Video footage of birdwing behaviour also show examples in which a male of Ornithoptera flies in front of, and slightly above, a female perched below, with her wings held horizontally 11 , or with her wings rapidly vibrating 12 .Footage of Ornithoptera courtship flights additionally shows the male ascending then dropping vertically to, or below, the female, alternately moving the ventral and dorsal wing surfaces above and below the viewing partner e.g.Ornithoptera richmondia 13 .Female birdwings have the observed capacity to refuse male courtship attempts, for example by dropping from flight to the ground and by extending their wings horizontally to prevent mating 5 .
Unlike some other butterflies, birdwings have been observed to rest frequently with wings held horizontally, and during feeding, for example, wings can be held in part-closed vshape 8 , although Tutt notes that a female T. brookiana observed in temporary captivity was also seen to settle to rest with the wings closed, exposing only the ventral surface to view 9 .It is noticeable in photographs and video of living birdwings that the dorsal hindwings can be comparatively visible in both Troides and Ornithoptera, for example undergoing less motion and/or being held at a wider angle than the forewings (e.g.field photos in 8 ).

Natural versus sexual selection -Supplementary Note 2
There are multiple definitions of sexual selection and its distinctions from natural selection have been debated.However, one useful broad distinction is to group under sexual selection, variation in mating success resulting from interactions including mate choice and intra-sexual competition 14,15 .Natural selection then encompasses the remainder of selective pressures affecting fitness.Both natural selection and sexual selection can act on either sex [14][15][16][17] .It has been noted 18 that male variability has sometimes been automatically attributed to sexual selection.However, any variation in natural selection on males (e.g.resulting from sexually variable aspects of behaviour or ecology) can also be predicted to cause, or contribute to, evolution of male phenotypes.All else being equal, equal selection pressures predict equal phenotypes in both sexes 19 .However, where natural selection pressures acting on two sexes differ 20,21,18 , their phenotypes may evolve accordingly, in either sex, or in both sexes.As known to Darwin 14 , sexual selection can also act on either sex, with extent and outcomes affected by factors including relative energetic contributions to offspring production (in butterflies likely higher in females 18,20,22 ), relationship between mating success and number of offspring 23,24 , and the variation in extent of visual mate choice 25 .Overall phenotype is then expected to depend on the combined outcome of natural and sexual selection, their interactions 25 and constraints 26 .Key evidence supporting a role for sexual selection on male birdwing butterflies includes observations of female mate choice, including courtship rejection 5 , alongside the sexually dimorphic, conspicuous and diverse wing colour pattern and shape phenotypes of birdwing males.

Fig. S2. Image pixel correlations for pairs of images that are both males versus both females.
Each panel row shows plot and statistics for matched pairwise comparisons for randomly selected image pairs that meets the conditions that two images in a sampled pair must be of different species and the same wing surface (i.e. both images dorsal or both images ventral).These analyses show a small but significant increase in average pixel correlation for male versus female images, potentially resulting from differential effects of the sensitivity of pixel correlation to image feature translation (see Fig. S2).In contrast, in general, ML CNNS are insensitive to translation 27 .From neighbour-joining trees based on the complement of pixel correlations for females (g) or males (h).From neighbour-joining trees based on embedding distance for females (i) or males (j).Pixel correlation shows reduced phylogenetic quality for female versus male images (median difference 0.087 3 d.p.) whereas ML embedding distance shows the same median distance to 2 decimal places for males and females.Additional analyses rescaling each pixel correlation matrix to a proportion of its maximum confirm a higher phylogenetic distance from genetic trees for trees based on female rather than male images (median difference 0.029 to 3 d.p.

Fig. S1 .
Fig. S1.Comparison between inter-image embedding distances and inter-image RGB pixel correlations.Each panel row shows plot and statistics for matched pairwise comparisons for 1,000,000 image pairs randomly selected from the full image dataset (of 16,734 butterfly photographs).There are significant negative correlations between proportionate inter-image distance in the embeddings (trained for 10 epochs) and the RGB pixel correlation coefficient for the corresponding image pair (p < 0.001, n = 1,000,000 randomly sampled image pairs).However, there is considerable scatter (correlation coefficient > -0.45), demonstrating that the information on visual similarity captured by the embedding is distinct from that captured by simple comparisons of overlying image pixels.Restricting pixel comparisons to image pairs from different species, and showing the same wing surface (removing, respectively intra-specific, and inter-surface variation) increases the correlation with embedding distances (correlation coefficient: 64 pixels -0.4681, 32 pixels -0.4445, 16 pixels -0.4658, 4 d.p., n = 1,000,000 image pairs).

Fig. S3 .
Fig. S3.Comparison between image pixel correlation and ML embedding results for females versus males.a-b) Mean pixel correlations for interspecies pairwise image comparisons among images of females (a) or males (b).n = 205250 image pairs.c-d) Complements of pixel correlations.e-f) Pairwise centroid distances for ML embedded locations of images of females (a) or males (b).n = 16,734 images.g-j) Incongruence with genetic phylogenetic distances measured by the Euclidean distance tree similarity measure.From neighbour-joining trees based on the complement of pixel correlations for females (g) or males (h).From neighbour-joining trees based on embedding distance for females (i) or males (j).Pixel correlation shows reduced phylogenetic quality for female versus male images (median difference 0.087 3 d.p.) whereas ML embedding distance shows the same median distance to 2 decimal places for males and females.Additional analyses rescaling

Visualisations of phenotypic embedding structure as ML training proceeds.
28Additional analyses rescaling each pairwise embedding distance to a proportion if its maximum give median Euclidean tree distances from gene trees of 2.415 for females and 2.40 for males (to 3 d.p).2DUMAP visualisations of embeddings structure at example epochs (a 10, b 100, c 400, d 450, e 1000, f, 2990) drawn from a ML training run (number 8) of 3000 total epochs.Data points represent embedding positions of 16,734 individual photographs.Colours correspond to groupings of taxonomic, phylogenetic and biological interest (top to bottom: the training label of species; genus; previously hypothesised morphological4and phylogenetic28species groups; biological sex; and imaged surface).In early training (e.g.epoch 10), the main division in 2D visualisations of embedding structure is the separation of a large phenotypic cluster containing genera Troides and Ornithoptera from a cluster primarily containing genus Trogonoptera, which has been found to be first diverging in independent genetic phylogenies28; although other structure corresponding, for example, to sex and surface is already present.Large-scale aspects of variation in the image dataset such as inter-genus and inter-sex variation are salient relatively earlier in network training (referred to as 'early' embeddings), but corresponding clusters might emerge at different specific times e.g. 10 epochs, or 20 etc. dependence on stochastic variation between independent training runs.By 400 epochs in the figured run, the three genera, for example, are all distinctly separated.At multiple points, there are interesting minor deviations from broad structural patterns, indicating for example, species from different genera with comparatively high visual similarity (e.g.epoch 100).Through early to mid-training, structure corresponding to previously hypothesised phenotypic and phylogenetic species groups is visible (e.g.epochs 100-450).

Comparison of phylogenetic trees based on ML phenotypic distance versus independent, housekeeping genes
. 9900 pairwise Euclidean (branch length) tree distances: (blue) among 100 Bayesian coalescent phylogenetic trees of 30 birdwing butterfly species, based on all published DNA sequences for 4 housekeeping genes and sampled post burn-in; (orange) among 100 randomised trees; (green) between a phenotypic ML tree, reconstructed from a ML embedding of 16,734 birdwing butterfly photographs, and the genetic trees.Measures of similarity between our machine learnt phenotypic trees and independent genetic signals (green) overlap the natural range of variation in genetic signals themselves (blue), with a median and mean within this range (Inter gene-tree minimum=0.238,maximum=3.246,mean=2.073,median=2.091;further values, SI Computer Code 2), while providing unique information on visible phenotypic variation.